package com.jhs.kjs.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.jhs.kjs.dto.CarDTO;
import com.jhs.kjs.dto.CarDestination_DestinationDTOExt;
import com.jhs.kjs.dto.CarDetailInfo_CarDTO;
import com.jhs.kjs.dto.CarDriver_CarDTO;
import com.jhs.kjs.dto.CarInfoDTO;
import com.jhs.kjs.dto.CarSensorDTO;
import com.jhs.kjs.dto.CarSensor_PositionDTO;
import com.jhs.kjs.dto.CarStatusDTO;
import com.jhs.kjs.dto.CustomerDTO;
import com.jhs.kjs.dto.CustomerUserDTO;
import com.jhs.kjs.dto.DestinationExtDTO;
import com.jhs.kjs.dto.PaingDTO;
import com.jhs.kjs.dto.emma.EmmaDTO;
import com.jhs.kjs.model.daumMap.dto.DaumMapDTO;
import com.jhs.kjs.robot.core.ECoord2AddrBatch;
import com.jhs.kjs.service.IMapService;
import com.jhs.kjs.service.dao.IMapMapper;

public class MapServiceImpl implements IMapService {

	private IMapMapper mapper;

	public void setMapper(IMapMapper mapper) {
		this.mapper = mapper;
	}

	@Override
	public List<CarDriver_CarDTO> getCarInfoList(Long customeCode) {
//		return getCarInfoList_Test();
		return mapper.getCarInfoList(customeCode);
	}

	private List<CarDriver_CarDTO> getCarInfoList_Test(){
		List<CarDriver_CarDTO> list = new ArrayList<CarDriver_CarDTO>();
		CarDriver_CarDTO carDto = null;
		int ind = 0;
		long carCode = 123;
		carDto = new CarDriver_CarDTO();
		
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126886643d);
		carDto.setLat(037455928d);
		carDto.setCarCode(carCode+=3);
		
		
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126886643d);
		carDto.setLat(037455973d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126886673d);
		carDto.setLat(037456026d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126886728d);
		carDto.setLat(037456073d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126886806d);
		carDto.setLat(037456111d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126886888d);
		carDto.setLat(037456149d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126886978d);
		carDto.setLat(037456194d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126887081d);
		carDto.setLat(037456243d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126887198d);
		carDto.setLat(037456298d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126887328d);
		carDto.setLat(037456358d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		carDto = new CarDriver_CarDTO();
		carDto.setName("운전자"+ind++);
		carDto.setCarRegiNumber("차량번호"+ind);
		carDto.setAddress("우리동네 "+ind+" 번지");
		carDto.setLng(126887471d);
		carDto.setLat(037456424d);
		carDto.setCarCode(carCode+=3);
		list.add(carDto);

		return list;
	}
	
	@Override
	public List<CarSensorDTO> getCarPosition(DaumMapDTO car) {
		return mapper.getCarPosition(car);
	}

	@Override
	public CarInfoDTO getCarAllinfo(CarDTO car) {
		CarInfoDTO dto = mapper.getCarAllinfo(car);
		// 목적지 관련 세팅이 들어가야 한다.
		return dto;
	}

	@Override
	public CarStatusDTO getCarStatusDetail(Long carCode) {
		return mapper.getCarStatusDetail(carCode);
	}

	@Override
	public CarInfoDTO getCarInfo(Long carCode) {
		return mapper.getCarInfo(carCode);
	}
	

	@Override
	public List<DestinationExtDTO> getCarDestiniationList(Long carCode) {
		return mapper.getCarDestiniationList(carCode);
	}

	@Override
	public CarSensorDTO getCarLocation(DaumMapDTO mapDTO) {
		return mapper.getCarLocation(mapDTO);
	}

	@Override
	public List<CarDetailInfo_CarDTO> getTotalCarList(CarDetailInfo_CarDTO param) {
		return mapper.getTotalCarList(param);
	}

	@Override
	public CarDetailInfo_CarDTO gettingCarNewInfo(CarDetailInfo_CarDTO param) {
		return mapper.gettingCarNewInfo(param);
	}

	@Override
	public List<PaingDTO> getPagingInfo(DaumMapDTO param) {
		try {
			ECoord2AddrBatch.MACHINE.makingPagingAddr(param);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return this.mapper.getPagingInfo(param);
	}

	@Override
	public PaingDTO getPagingInfoCount(DaumMapDTO mapDto) {
		return this.mapper.getPagingInfoCount(mapDto);
	}

	@Override
	public DaumMapDTO getAreaByCarCode(DaumMapDTO mapParam) {
		return this.mapper.getAreaByCarCode(mapParam);
	}

	@Override
	public List<PaingDTO> drawMarkerM120(DaumMapDTO mapDTO) {
		return this.mapper.drawMarkerM120(mapDTO);
	}

	@Override
	public List<CarDestination_DestinationDTOExt> getDestinationList(
			Map<String, String> param) {
		return this.mapper.getDestinationList(param);
	}

	@Override
	public  List<PaingDTO>  getCarRootExcel(DaumMapDTO mapParam) {
		try {
			ECoord2AddrBatch.MACHINE.makingPagingAddr(mapParam);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return this.mapper.getCarRootExcel(mapParam);
	}

	@Override
	public Long getDayDistance(DaumMapDTO mapParam) {
		return this.mapper.getDayDistance(mapParam);
	}

	@Override
	public List<CarSensorDTO> getCarRoute(DaumMapDTO mapParam) throws Exception {
		return this.mapper.getCarRoute(mapParam);
	}

	@Override
	public int getCustomerSerivceValue(EmmaDTO emma) throws Exception {
		return this.mapper.getCustomerSerivceValue(emma);
	}

	@Override
	public CustomerDTO getCustomer(CustomerUserDTO user) throws Exception {
		return this.mapper.getCustomer(user);
	}
}
